﻿function SiteJs_AddFav() {
    try {
        window.external.addFavorite(window.location.href, document.title);
    }
    catch (e) {
        try {
            window.sidebar.addPanel(document.title, window.location.href, "");
        }
        catch (e) {
            alert("抱歉，您所使用的浏览器无法完成此操作。\n\n加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

function SiteJs_SetHomepage() {
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(window.location.href);
    } else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
            }
            catch (e) {
                alert('此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为’true’,双击即可。');
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage', window.location.href);
        }
    }
}

function smschange(showId) {
    var ddl = document.getElementById("smsDDL");
    var Text = ddl.options[ddl.selectedIndex].text;
    document.getElementById(showId).value = Text;
    document.getElementById("show").style.display = 'none';
}

function hidediv() {
    document.getElementById("show").style.display = 'none';
}

function scrollToAnchor (anchorname) {
    var $body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
    $body.animate({
        scrollTop: $("a[name='"+anchorname+"']").offset().top
    }, 2000, 'easeOutBounce');

    return false;
}
function InitTableHilighter() {
    $("table.width:not(.noborder) tr").click(function () {
        $(this).closest("table").find("tr.HighlightTr").removeClass("HighlightTr");
        $(this).closest("tr").addClass("HighlightTr");
    });
}

function InitTableHilighter(selector) {
    $("table"+selector+" tr").click(function () {
        $(this).closest("table").find("tr.HighlightTr").removeClass("HighlightTr");
        $(this).closest("tr").addClass("HighlightTr");
    });
}